package array
{
	import flash.utils.ByteArray;
	
	import kinds.NamespaceKind;
	
	import util.BytesUtil;

	public dynamic class NsArray extends Array
	{
		public function NsArray(...parameters)
		{
			super(parameters);
		}
		
		public function fill(bytes:ByteArray, arr:StringArray):void
		{
			var count:uint = BytesUtil.readU30(bytes);
			if(count > 0){
				this[0] = {kind:0, name:"public"};
				for(var i:int = 1; i < count; i++){
					var kind:uint = bytes.readUnsignedByte();
					var index:int = BytesUtil.readU30(bytes);
					if(kind == NamespaceKind.CONSTANT_PrivateNs){
						this[i] = {kind:kind, name:"private"};
					}
					else{
						this[i] = {kind:kind, name:arr[index]};
					}
				}
			}
		}
	}
}